var express = require("express");
var defaultRouter = express.Router();
const DefaultDao = require("../dao/default_dao");

// 获取热门文章列表
defaultRouter.get("/getAllArticleList", (req, res) => {
  DefaultDao.getAllArticleList(req, res);
});

// 根据文章Id获取文章信息
defaultRouter.get("/getArticleById", (req, res) => {
  DefaultDao.getArticleById(req, res);
});

// 获取菜单标题名称和编号
defaultRouter.get("/getTypeInfo", (req, res) => {
  DefaultDao.getTypeInfo(req, res);
});

// 增加网站访客数
defaultRouter.post("/addTodayVisitor", (req, res) => {
  DefaultDao.addTodayVisitor(req, res);
});

// 增加文章访问数
defaultRouter.post("/addArticleVisitor", (req, res) => {
  DefaultDao.addArticleVisitor(req, res);
});

// 增加文章访问数
defaultRouter.post("/addArticleVisitor", (req, res) => {
  DefaultDao.addArticleVisitor(req, res);
});

// 根据文章类型获取文章
defaultRouter.get("/getArticleByTag", (req, res) => {
  DefaultDao.getArticleByTag(req, res);
});

// 获取推荐文章
defaultRouter.get("/getRecommendArticle", (req, res) => {
  DefaultDao.getRecommendArticle(req, res);
});

// 获得文章类型及数量
defaultRouter.get("/getArticleTypeAndAmount", (req, res) => {
  DefaultDao.getArticleTypeAndAmount(req, res);
});

// 添加评论
defaultRouter.post("/addArticleComment", (req, res) => {
  DefaultDao.addArticleComment(req, res);
});

// 根据文章Id获取文章评论
defaultRouter.get("/getArticleCommentById", (req, res) => {
  DefaultDao.getArticleCommentById(req, res);
});

// 更新评论点赞数
defaultRouter.post("/updateCommentPrefer", (req, res) => {
  DefaultDao.updateCommentPrefer(req, res);
});


module.exports = defaultRouter;